From: Jasper St. Pierre Date: Sat, 20 Apr 2013 01:16:19 +0000 (-0400) Subject: popupMenu: Use a checkmark for boolean items X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~4296 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=b03e480dbff5790e63b22241fc311e0caeca1706;p=gnome-shell.git popupMenu: Use a checkmark for boolean items This matches GTK+'s styling, and it makes most boolean switches look more natural, as a lot of booleans are not meant for hardware switches. https://bugzilla.gnome.org/show_bug.cgi?id=698427 --- diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js index 9844baf2e..041434eac 100644 --- a/js/ui/popupMenu.js +++ b/js/ui/popupMenu.js @@ -1869,18 +1869,20 @@ const RemoteMenu = new Lang.Class({ // always returns null // Funny :) + item = new PopupMenuItem(label); + switch (String.fromCharCode(action.state.classify())) { case 'b': - item = new PopupSwitchMenuItem(label, action.state.get_boolean()); action.items.push(item); - specificSignalId = item.connect('toggled', Lang.bind(this, function(item) { + item.setOrnament(action.state.get_boolean() ? + Ornament.CHECK : Ornament.NONE); + specificSignalId = item.connect('activate', Lang.bind(this, function(item) { this.actionGroup.activate_action(action_id, null); })); break; case 's': - item = new PopupMenuItem(label); - item._remoteTarget = model.get_item_attribute_value(index, Gio.MENU_ATTRIBUTE_TARGET, null).deep_unpack(); action.items.push(item); + item._remoteTarget = model.get_item_attribute_value(index, Gio.MENU_ATTRIBUTE_TARGET, null).deep_unpack(); item.setOrnament(action.state.deep_unpack() == item._remoteTarget ? Ornament.DOT : Ornament.NONE); specificSignalId = item.connect('activate', Lang.bind(this, function(item) { @@ -2010,7 +2012,8 @@ const RemoteMenu = new Lang.Class({ switch (String.fromCharCode(action.state.classify())) { case 'b': for (let i = 0; i < action.items.length; i++) - action.items[i].setToggleState(action.state.get_boolean()); + action.items[i].setOrnament(action.state.get_boolean() ? + Ornament.CHECK : Ornament.NONE); break; case 'd': for (let i = 0; i < action.items.length; i++)